<?php
require_once('../lib/standard.php');
set_pineza(TRUE);
?>
<link rel="stylesheet" type="text/css" href="<?php print $pineza->server; ?>boardSB/boardSB.css" />
<script type="text/javascript" src="<?php print $pineza->server; ?>boardSB/boardSB.js"></script>
</head>
<body>
<?php
board_paleta();
?>
</body>
</html>
<?php

function board_paleta() {
	global $pineza;
	$query = "SELECT * FROM `board` WHERE `user` = '" .
		escape($pineza->login) . "' ORDER BY `color`";
	$result = mysqli_query($pineza->db, $query);
	if (!$result)
		telos('board_paleta: ' . mysqli_error($pineza->db));
	while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
		?>
		<div class="boardItem" onclick="leaveNote('<?php print $row['color']; ?>');"
			onmouseover="setBoardTitle(this, '<?php
				print strip_tags($row['title']); ?>');" ondblclick="editPinakasTitle('<?php
				print $row['color']; ?>');">
			<?php sidebar_board($row); ?>
		</div>
		<?php
	}
}

function sidebar_board($row) {
	?>
	<input id="pt<?php print $row['color']; ?>" type="text" maxlength="250" size="30"
		value="<?php print htmlspecialchars($row['title']); ?>" class="onomaPinakaPedio"
		style="display: none;" onkeypress="onomaPinakaUpdate(event, '<?php
			print $row['color']; ?>');"
			onclick="clickTitlosPinaka(event, '<?php
			print $row['color']; ?>');" />
	<table width="100%">
		<tr>
			<td class="tbldbg" style="width: 1px; vertical-align: top;">
				<?php board_icon($row['color']); ?>
			</td>
			<td class="tbldbg" style="vertical-align: top;">
				<div class="boardTitle">
					<?php print $row['title']; ?>
				</div>
				<div id="SBmb<?php print $row['color']; ?>">
					<?php mikrografies($row['color']); ?>
				</div>
			</td>
		</tr>
	</table>
	<?php
}

function board_icon($color) {
	global $pineza;
	if (!$color) {
		?>
		<div class="keno boardIcon boardIconBorder" style="background-image: url('<?php
			print $pineza->server; ?>images/wallSmall.png');">
		</div>
		<?php
	}
	elseif ($color == 'TRASH') {
		?>
		<img src="<?php print $pineza->server; ?>images/trash.png"
			class="boardIcon" alt="board icon" />
		<?php
	}
	else {
		?>
		<img src="<?php print $pineza->server; ?>images/tsoxes/<?php
			print $color; ?>.jpg" class="boardIcon" alt="board icon" />
		<?php
	}
}

?>
